package main

import (
	"fmt"
	"log/slog"
	"net"
	"zenoLink/log"
	"zenoLink/server"
)

func Init() {
	log.InitLog()
}

func main() {
	Init()

	addr := ":9999"

	slog.Info(fmt.Sprintf("server start , addr %v", addr))
	ser, err := net.Listen("tcp", addr)
	if err != nil {
		fmt.Printf("Listen failed: %v\n", err)
		return
	}

	defer func() {
		slog.Info("server done")
	}()

	for {
		client, err := ser.Accept()
		if err != nil {
			fmt.Printf("Accept failed: %v", err)
			continue
		}

		handle := server.Socket5Server{}
		go handle.Process(client)
	}

}
